#ifndef NETDRIVER_H
#define NETDRIVER_H

#include <QObject>

class QTcpSocket;
class NetDriver : public QObject
{
    Q_OBJECT
public:
    explicit NetDriver(QObject *parent = nullptr);
    static NetDriver *getObject();
    bool netConnect1(QString ip ,quint16 port);
    void netConnect2(QString ip,quint16 port);
    void netDisconnect();
    bool netGetState();
    bool netWrite (const QByteArray &data);
protected:
    static NetDriver *obj;
    QTcpSocket *client;
signals:
    void netConnected();//连接的信号
    void netDisconnected();//断开连接的信号
    void netRead(const QByteArray &data);//获取到信息的信号
public slots:
    void netReadSlot();
};

#endif // NETDRIVER_H
